package service;

import java.util.List;

import dao.UserDao;
import entity.Users;

public class UserService {
	UserDao dao=new UserDao();
	public List<Users> QueryAllUsers(){
		return dao.Select_All();
	}

	public Users SelectByID(int uid) {//根据ID查询数据
		return dao.SelectByID(uid);
	}
	public Boolean UpdateByID(int uid,Users user) {//根据ID修改数据
		if(dao.IsExsist(uid)) {
			return dao.Update(uid, user);
		}
		return false;
	}
	public Boolean DeleteByID(int uid) {//根据ID删除数据
		if(dao.IsExsist(uid)) {
			return dao.Delete(uid);
		}
		return false;
	}
	public Boolean addUser(Users user ) {//添加数据
		if(!dao.IsExsist(user.getUID())){
			dao.Add(user);
			return true;
		}else {
			System.out.println("此人已存在！");
			return false;
		}
		
	
	}
}
